package com.promise.jokerdream.repository

import com.promise.jokerdream.network.HttpApiConstants
import com.promise.jokerdream.response.pc.FightAbyssTidePCResponse
import com.promise.jokerdream.response.pc.QueryScratchCardPCResponse
import com.promise.jokerdream.response.pc.QuerySourceTreePCResponse
import com.promise.jokerdream.response.pc.QueryBlessTreeResponse
import com.promise.jokerdream.response.pc.QueryEnchantResponse
import com.promise.jokerdream.response.pc.QuerySkillEnhanceResponse
import com.promise.jokerdream.response.pc.QueryWeaponSpecializeResponse
import com.promise.jokerdream.response.pc.QueryAncientGodFormationResponse
import com.promise.jokerdream.response.pc.QueryOutfitResponse
import com.promise.jokerdream.response.pc.QuerySectMeleeCheerResponse
import com.promise.jokerdream.response.pc.QuerySectMeleeRewardResponse
import com.promise.jokerdream.response.pc.QueryTBattleResponse
import com.promise.jokerdream.response.pc.QueryLuckyWheelResponse
import com.promise.jokerdream.response.pc.QueryChaosWarResponse
import com.promise.jokerdream.response.pc.QueryChaosWarTaskResponse
import com.promise.jokerdream.response.pc.BagGoodsPCResponse
import com.promise.jokerdream.response.pc.FactionCommerceExchangePCResponse
import com.promise.jokerdream.response.pc.FactionCommerceTradePCResponse
import com.promise.jokerdream.response.pc.QueryDailyChestResponse
import com.promise.jokerdream.response.pc.QueryDailyGiftResponse
import com.promise.jokerdream.response.pc.QueryCalenderResponse
import com.promise.jokerdream.response.pc.QueryCalendarFateResponse
import com.promise.jokerdream.response.pc.QueryMistyResponse
import com.promise.jokerdream.response.pc.QueryPenguinTraveloguePCResponse
import com.promise.jokerdream.response.pc.TenlotteryGiftPCResponse
import com.promise.jokerdream.response.pc.QueryFactionCommerceGiftPCResponse
import com.promise.jokerdream.response.pc.QueryMidAutumnGiftPCResponse
import com.promise.jokerdream.response.pc.QueryKnightLnnLobbyPCResponse
import com.promise.jokerdream.response.pc.QueryKnightLnnRoomPCResponse
import com.promise.jokerdream.response.pc.QueryKnightDreamResponse
import com.promise.jokerdream.response.pc.FightKnightDreamResponse
import com.promise.jokerdream.response.pc.QueryKnightIslandMissionPCResponse
import com.promise.jokerdream.response.pc.QueryMercenaryDispatchPCResponse
import com.promise.jokerdream.response.pc.QueryImmortalsPCResponse
import com.promise.jokerdream.response.pc.FightMistyPCResponse
import com.promise.jokerdream.response.pc.FightConstellationPCResponse
import com.promise.jokerdream.response.pc.FightMapPushResponse
import com.promise.jokerdream.response.pc.QueryConstellationPCResponse
import com.promise.jokerdream.response.pc.PenguinComebackPCResponse
import com.promise.jokerdream.response.pc.QueryAbyssTidePCResponse
import com.promise.jokerdream.response.pc.QueryFightTowerResponse
import com.promise.jokerdream.response.pc.FightTowerResponse
import com.promise.jokerdream.response.pc.QueryAbyssTideGiftPCResponse
import com.promise.jokerdream.response.pc.QueryAbyssDrawResponse
import com.promise.jokerdream.response.pc.QueryDreamTripPCResponse
import com.promise.jokerdream.response.pc.QueryLuckyExchangePCResponse
import com.promise.jokerdream.response.pc.QueryLuckyGoldenEggResponse
import com.promise.jokerdream.response.pc.QueryKitchenResponse
import com.promise.jokerdream.response.pc.QuerySectTaskPCResponse
import com.promise.jokerdream.response.pc.QuerySectIncenseResponse
import com.promise.jokerdream.response.pc.QuerySectTrainingResponse
import com.promise.jokerdream.response.pc.QueryClawMachinePCResponse
import com.promise.jokerdream.response.pc.QuerySaviorsTurntablePCResponse
import com.promise.jokerdream.response.pc.QueryGiftsRisingPCResponse
import com.promise.jokerdream.response.pc.QueryDailyGiftExchangePCResponse
import com.promise.jokerdream.response.pc.QueryFactionChallengePCResponse
import com.promise.jokerdream.response.pc.QueryAllFriendPCResponse
import com.promise.jokerdream.response.pc.QueryArenaInfoPCResponse
import com.promise.jokerdream.response.pc.QueryAscendHeavenResponse
import com.promise.jokerdream.response.pc.QueryBirthdayResponse
import com.promise.jokerdream.response.pc.QueryFactionMemberPCResponse
import com.promise.jokerdream.response.pc.QueryLivenessResponse
import com.promise.jokerdream.response.pc.QueryPenguinInfoPCResponse
import com.promise.jokerdream.response.pc.QueryNpcInfoPCResponse
import com.promise.jokerdream.response.pc.QueryHideInfoResponse
import com.promise.jokerdream.response.pc.QueryPenguinShareResponse
import com.promise.jokerdream.response.pc.QueryPenguinTaskPCResponse
import com.promise.jokerdream.response.pc.RewardPenguinTaskPCResponse
import com.promise.jokerdream.response.pc.QueryWlmzResponse
import com.promise.jokerdream.response.pc.QueryWulinResponse
import com.promise.jokerdream.response.pc.QueryPeakBattleResponse
import com.promise.jokerdream.response.pc.ScratchCardPCResponse
import com.promise.jokerdream.response.pc.SimplePCResponse
import com.promise.jokerdream.response.pc.QueryFormationTypeResponse
import com.promise.jokerdream.response.pc.QueryFormationListResponse
import com.promise.jokerdream.response.pc.QueryFactionAltarResponse
import com.promise.jokerdream.response.pc.SpinFactionAltarWheelResponse
import com.promise.jokerdream.response.pc.QueryFactionAltarRobResponse
import com.promise.jokerdream.response.pc.QueryScrollDungeonResponse
import com.promise.jokerdream.response.pc.QueryEscortStatusPCResponse
import com.promise.jokerdream.response.pc.QueryEscortHomeResponse
import com.promise.jokerdream.response.pc.QueryEscortChooseResponse
import com.promise.jokerdream.response.pc.QueryFactionArmyResponse
import com.promise.jokerdream.response.pc.QueryFactionLeagueResponse
import com.promise.jokerdream.response.pc.QueryFactionMinePCResponse
import com.promise.jokerdream.response.pc.QueryFactionTaskPCResponse
import com.promise.jokerdream.response.pc.QueryForageWarResponse
import com.promise.jokerdream.response.pc.QueryHavocTreasureResponse
import com.promise.jokerdream.response.pc.QueryMapPushResponse
import com.promise.jokerdream.response.pc.QueryPenguinRecallResponse
import com.promise.jokerdream.response.pc.QueryPenguinStationResponse
import com.promise.jokerdream.response.pc.QuerySectTournamentResponse
import com.promise.jokerdream.response.pc.QueryThronesBattleResponse
import com.promise.jokerdream.response.pc.QueryWishResponse
import com.promise.jokerdream.response.pc.RewardWishResponse
import com.promise.jokerdream.response.pc.ShareGameResponse
import com.promise.jokerdream.response.pc.QueryLotteryResponse
import com.promise.jokerdream.response.pc.QueryActMenuResponse
import com.promise.jokerdream.response.pc.QueryKnightAreanTeamResponse
import com.promise.jokerdream.response.pc.QueryKnightArenaListResponse
import com.promise.jokerdream.response.pc.QueryKnightArenaResponse
import com.promise.jokerdream.response.pc.QueryOddEvenResponse
import com.promise.jokerdream.response.pc.QueryLoginGiftResponse
import com.promise.jokerdream.response.pc.QueryBadgeResponse
import com.promise.jokerdream.response.pc.QueryActiveGiftResponse
import com.promise.jokerdream.response.pc.QueryKnightFightResponse
import com.promise.jokerdream.response.pc.QueryWeeklyGiftResponse
import com.promise.jokerdream.utils.UrlUtils

/**
 * 游戏API接口
 * 定义所有的API调用方法
 */
class GameApi {
    private val repository = GameRepository.getInstance()
    // ==================== 刮刮卡相关API ====================

    // 查询刮刮卡信息
    suspend fun queryScratchCard(): Result<QueryScratchCardPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "139",
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryScratchCardPCResponse>(url)
    }


    // 刮刮卡操作
    suspend fun scratchCard(): Result<ScratchCardPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "139",
            "op" to "1", // 刮卡操作
        ))
        return repository.getAndParse<ScratchCardPCResponse>(url)
    }


    // 领取刮刮卡奖励c
    suspend fun rewardScratchCard(cardId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "139",
            "op" to "2", // 领取操作
            "id" to cardId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // ==================== 乐斗游记相关API ====================
    
    // 查询乐斗游记信息
    suspend fun queryPenguinTravelogue(): Result<QueryPenguinTraveloguePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "165",
            "op" to "1" // 查询操作
        ))
        return repository.getAndParse<QueryPenguinTraveloguePCResponse>(url)
    }


    // 领取乐斗游记任务奖励
    suspend fun rewardPenguinTravelogueTask(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "165",
            "op" to "2", // 领取任务操作
            HttpApiConstants.UrlParams.REAL_TASK_ID to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // 乐斗游记一键领取
    suspend fun oneClickRewardPenguinTravelogue(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "165",
            "op" to "6" // 一键领取操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // 乐斗游记兑换传功符
    suspend fun exchangePenguinTravelogueItem(num: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "165",
            "op" to "3", // 兑换操作
            "num" to num.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // ==================== 大侠回归相关API ====================
    
    // 查询大侠回归信息
    suspend fun queryPenguinComeback(): Result<PenguinComebackPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "162",
            "op" to "1" // 查询操作
        ))
        return repository.getAndParse<PenguinComebackPCResponse>(url)
    }

    // 领取大侠回归奖励
    suspend fun rewardPenguinComeback(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "162",
            "op" to "2", // 领取操作
            "taskid" to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // ==================== 吉利兑相关API ====================

    // 查询吉利兑信息
    suspend fun queryLuckyExchange(): Result<QueryLuckyExchangePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.luckyExchange, mapOf(
            "op" to HttpApiConstants.OP.VIEW_INDEX // 查询操作
        ))
        return repository.getAndParse<QueryLuckyExchangePCResponse>(url)
    }


    // 领取吉利兑奖励
    suspend fun rewardLuckyExchange(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.luckyExchange, mapOf(
            "op" to HttpApiConstants.OP.GET_TASK_REWARD, // 领取操作
            "taskid" to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // ==================== 侠士客栈相关API ====================

    // 查询侠士客栈大堂信息
    suspend fun queryKnightLnnLobby(): Result<QueryKnightLnnLobbyPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knight, mapOf(
            "op" to "13" // 查询大堂操作
        ))
        return repository.getAndParse<QueryKnightLnnLobbyPCResponse>(url)
    }

    // 查询侠士客栈房间信息
    suspend fun queryKnightLnnRoom(): Result<QueryKnightLnnRoomPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knight, mapOf(
            "op" to "15" // 查询房间操作
        ))
        return repository.getAndParse<QueryKnightLnnRoomPCResponse>(url)
    }

    // 领取侠士客栈奖励
    suspend fun getKnightLnnAward(id: Int, type: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knight, mapOf(
            "op" to "14", // 领奖操作
            "type" to type.toString(),
            "id" to id.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 幻境相关API ====================

    // 查询幻境信息
    suspend fun queryMisty(): Result<QueryMistyResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.misty, emptyMap())
        return repository.getAndParse<QueryMistyResponse>(url)
    }

    // 开始幻境
    suspend fun startMisty(stageId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.misty, mapOf(
            "op" to HttpApiConstants.OP.START, // 开始操作
            "stage_id" to stageId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 幻境挑战
    suspend fun fightMisty(): Result<FightMistyPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.misty, mapOf(
            "op" to HttpApiConstants.OP.FIGHT // 挑战操作
        ))
        return repository.getAndParse<FightMistyPCResponse>(url)
    }

    // 退出幻境
    suspend fun endMisty(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.misty, mapOf(
            "op" to HttpApiConstants.OP.RETURN // 退出操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 仙武修真相关API ====================

    // 查询仙武修真当前寻访进展
    suspend fun queryImmortals(): Result<QueryImmortalsPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.immortals, mapOf(
            "op" to HttpApiConstants.OP.FIND_IMMORTALS // 查询操作
        ))
        return repository.getAndParse<QueryImmortalsPCResponse>(url)
    }

    // 寻访仙武修真
    suspend fun visitImmortals(mountainId: Int): Result<QueryImmortalsPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.immortals, mapOf(
            "op" to HttpApiConstants.OP.VISIT_IMMORTALS, // 寻访操作
            "mountainId" to mountainId.toString()
        ))
        return repository.getAndParse<QueryImmortalsPCResponse>(url)
    }

    // 挑战仙武修真
    suspend fun fightImmortals(): Result<QueryImmortalsPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.immortals, mapOf(
            "op" to HttpApiConstants.OP.FIGHT_IMMORTALS // 挑战操作
        ))
        return repository.getAndParse<QueryImmortalsPCResponse>(url)
    }

    // 领取仙武修真任务奖励
    suspend fun getImmortalsReward(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.immortals, mapOf(
            "op" to HttpApiConstants.OP.GET_REWARD, // 领奖操作
            "taskid" to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 乐斗黄历相关API ====================

    // 查询乐斗黄历信息
    suspend fun queryCalendar(): Result<QueryCalenderResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.calender, mapOf(
            "op" to HttpApiConstants.OP.VIEW_CALENDER // 查询黄历操作
        ))
        return repository.getAndParse<QueryCalenderResponse>(url)
    }

    // 查询占卜信息
    suspend fun queryCalendarFate(): Result<QueryCalendarFateResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.calender, mapOf(
            "op" to HttpApiConstants.OP.VIEW_FATE // 查看占卜信息操作
        ))
        return repository.getAndParse<QueryCalendarFateResponse>(url)
    }

    // 乐斗黄历领奖
    suspend fun getCalendarReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.calender, mapOf(
            "op" to HttpApiConstants.OP.GET_TORTSH // 领奖操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 乐斗黄历占卜
    suspend fun divinationCalendar(): Result<QueryCalendarFateResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.calender, mapOf(
            "op" to HttpApiConstants.OP.DO_DIVINATION // 占卜操作
        ))
        return repository.getAndParse<QueryCalendarFateResponse>(url)
    }

    // ==================== 邪神秘宝相关API ====================

    // 查询邪神秘宝信息
    suspend fun queryTenlottery(): Result<TenlotteryGiftPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.tenlottery, mapOf(
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<TenlotteryGiftPCResponse>(url)
    }

    // 领取邪神秘宝奖励
    suspend fun rewardTenlottery(type: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.tenlottery, mapOf(
            "op" to "2", // 领奖操作
            "type" to type.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 商会相关API ====================

    // 查询商会礼包信息
    suspend fun queryFactionCommerceGift(): Result<QueryFactionCommerceGiftPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionCommerce, mapOf(
            "op" to "0" // 查礼包操作
        ))
        return repository.getAndParse<QueryFactionCommerceGiftPCResponse>(url)
    }

    // 领取商会礼包
    suspend fun getFactionCommerceGift(giftId: Int, type: Int): Result<QueryFactionCommerceGiftPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionCommerce, mapOf(
            "op" to "3", // 领礼包操作
            HttpApiConstants.UrlParams.GIFT_ID to giftId.toString(),
            "type" to type.toString()
        ))
        return repository.getAndParse<QueryFactionCommerceGiftPCResponse>(url)
    }

    // 查询商会交易信息
    suspend fun queryFactionCommerceTrade(): Result<FactionCommerceTradePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionCommerce, mapOf(
            "op" to "1" // 查交易操作
        ))
        return repository.getAndParse<FactionCommerceTradePCResponse>(url)
    }

    // 商会交易
    suspend fun factionCommerceTrade(goodsId: String, type: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionCommerce, mapOf(
            "op" to "4", // 交易操作
            "goods_id" to goodsId,
            "type" to type
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询商会兑换信息
    suspend fun queryFactionCommerceExchange(): Result<FactionCommerceExchangePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionCommerce, mapOf(
            "op" to "2" // 查兑换操作
        ))
        return repository.getAndParse<FactionCommerceExchangePCResponse>(url)
    }

    // 商会兑换
    suspend fun factionCommerceExchange(typeId: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionCommerce, mapOf(
            "op" to "5", // 兑换操作
            "type_id" to typeId
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 每日奖励相关API ====================
    
    // 查询每日奖励状态
    suspend fun queryDailyGift(): Result<QueryDailyGiftResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.dailyGift, emptyMap())
        return repository.getAndParse<QueryDailyGiftResponse>(url)
    }

    // 领取每日奖励
    suspend fun getDailyGift(key: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.dailyGift, mapOf(
            "op" to HttpApiConstants.OP.DRAW,
            "key" to key
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 每日宝箱相关API ====================

    // 查询每日宝箱信息
    suspend fun queryDailyChest(): Result<QueryDailyChestResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.dailyChest, emptyMap())
        return repository.getAndParse<QueryDailyChestResponse>(url)
    }

    // 领取每日宝箱
    suspend fun getDailyChest(type: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.dailyChest, mapOf(
            "op" to "open",
            "type" to type.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取斗豆月卡
    suspend fun getDouDouMonthlyCard(selfUin: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.douDouMonthlyCard, mapOf(
            HttpApiConstants.UrlParams.SELF_UIN to selfUin
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 中秋礼盒相关API ====================

    // 查询中秋礼盒信息
    suspend fun queryMidAutumnGift(): Result<QueryMidAutumnGiftPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.midAutumnGift, emptyMap())
        return repository.getAndParse<QueryMidAutumnGiftPCResponse>(url)
    }

    // 领取中秋礼盒奖励
    suspend fun getMidAutumnGift(taskId: Int): Result<QueryMidAutumnGiftPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.midAutumnGift, mapOf(
            "sub" to "1", // 领取礼盒操作
            "id" to taskId.toString()
        ))
        return repository.getAndParse<QueryMidAutumnGiftPCResponse>(url)
    }

    // 领取中秋神秘奖励
    suspend fun getMidAutumnMysteryReward(): Result<QueryMidAutumnGiftPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.midAutumnGift, mapOf(
            "sub" to "2" // 领取神秘奖励操作
        ))
        return repository.getAndParse<QueryMidAutumnGiftPCResponse>(url)
    }

    // ==================== 门派相关API ====================
    
    // 查询门派上香情况
    suspend fun querySectIncense(): Result<QuerySectIncenseResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sect, mapOf(
            "op" to "query_incense"
        ))
        return repository.getAndParse<QuerySectIncenseResponse>(url)
    }

    // 查询门派训练情况
    suspend fun querySectTraining(): Result<QuerySectTrainingResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sect, mapOf(
            "op" to HttpApiConstants.OP.SHOW_TRAINING
        ))
        return repository.getAndParse<QuerySectTrainingResponse>(url)
    }

    // 门派上香
    suspend fun sectFumigate(type: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sect, mapOf(
            "op" to HttpApiConstants.OP.FUMIGATE,
            "type" to type
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 门派打木桩
    suspend fun sectTrainWithNpc(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sect, mapOf(
            "op" to HttpApiConstants.OP.TRAIN_WITH_NPC
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 门派同门切磋
    suspend fun sectTrainWithMember(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sect, mapOf(
            "op" to HttpApiConstants.OP.TRAIN_WITH_MEMBER
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 门派切磋（掌门、首座、堂主）
    suspend fun sectTrainWithCouncil(rank: Int, pos: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sect, mapOf(
            "op" to HttpApiConstants.OP.TRAINING_WITH_COUNCIL,
            "rank" to rank.toString(),
            "pos" to pos.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询门派任务
    suspend fun querySectTask(): Result<QuerySectTaskPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectTask, mapOf())
        return repository.getAndParse<QuerySectTaskPCResponse>(url)
    }

    // 领取门派任务奖励
    suspend fun getSectTaskReward(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectTask, mapOf(
            "subtype" to "2",
            HttpApiConstants.UrlParams.REAL_TASK_ID to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 历练相关API ====================
    
    // 历练挑战
    suspend fun mapPushFight(npcId: Int): Result<FightMapPushResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.mapPush, mapOf(
            "type" to "1",
            HttpApiConstants.UrlParams.NPC_ID to npcId.toString()
        ))
        return repository.getAndParse<FightMapPushResponse>(url)
    }

    // 查询历练地图信息
    suspend fun queryMapPush(mapId: Int): Result<QueryMapPushResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.mapPush, mapOf(
            "type" to "2",
            "mapid" to mapId.toString()
        ))
        return repository.getAndParse<QueryMapPushResponse>(url)
    }

    // 使用物品
    suspend fun useGoods(uin: String, goodsId: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.useGoods, mapOf(
            HttpApiConstants.UrlParams.SELF_UIN to uin,
            "id" to goodsId
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 飞升大作战相关API ====================

    // 查询飞升大作战状态
    suspend fun queryAscendHeaven(): Result<QueryAscendHeavenResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.ascendHeaven, mapOf())
        return repository.getAndParse<QueryAscendHeavenResponse>(url)
    }

    // 飞升大作战报名
    suspend fun ascendHeavenSignup(type: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.ascendHeaven, mapOf(
            "op" to HttpApiConstants.OP.SIGNUP,
            "type" to type.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 梦想之旅相关API ====================

    // 查询梦想之旅状态
    suspend fun queryDreamTrip(bmapId: Int): Result<QueryDreamTripPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.dreamTrip, mapOf(
            "subtype" to "0",
            HttpApiConstants.UrlParams.BMAP_ID to bmapId.toString()
        ))
        return repository.getAndParse<QueryDreamTripPCResponse>(url)
    }

    // 使用普通机票
    suspend fun useNormalTicket(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.dreamTrip, mapOf(
            "sub" to "1"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 使用梦幻机票
    suspend fun useDreamTicket(smapId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.dreamTrip, mapOf(
            "sub" to "1",
            HttpApiConstants.UrlParams.SMAP_ID to smapId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 抓娃娃机相关API ====================

    // 查询抓娃娃机信息
    suspend fun queryClawMachine(): Result<QueryClawMachinePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "114",
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryClawMachinePCResponse>(url)
    }

    // 抓娃娃机抽奖
    suspend fun claimClawMachine(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "114",
            "op" to "1" // 抽奖操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 神魔转盘相关API ====================

    // 查询神魔转盘信息
    suspend fun querySaviorsTurntable(): Result<QuerySaviorsTurntablePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "81",
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QuerySaviorsTurntablePCResponse>(url)
    }

    // 神魔转盘抽奖
    suspend fun claimSaviorsTurntable(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "81",
            "op" to "1" // 抽奖操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 好礼步步升相关API ====================

    // 查询好礼步步升信息
    suspend fun queryGiftsRising(): Result<QueryGiftsRisingPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "37"
            // 查询不带参数
        ))
        return repository.getAndParse<QueryGiftsRisingPCResponse>(url)
    }

    // 好礼步步升领取
    suspend fun claimGiftsRising(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "37",
            "op" to "get" // 领取操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 每日兑换礼包相关API ====================

    // 查询每日兑换礼包信息
    suspend fun queryDailyGiftExchange(): Result<QueryDailyGiftExchangePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "58"
            // 查询不带参数
        ))
        return repository.getAndParse<QueryDailyGiftExchangePCResponse>(url)
    }

    // 每日兑换礼包领取
    suspend fun claimDailyGiftExchange(index: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "58",
            "op" to "draw", // 领取操作
            "index" to index.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 帮派挑战相关API ====================

    // 查询帮派踢馆信息
    suspend fun queryFactionChallenge(): Result<QueryFactionChallengePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionChallenge, mapOf(
            "subtype" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryFactionChallengePCResponse>(url)
    }

    // 帮派踢馆试炼
    suspend fun factionChallengeTrial(): Result<QueryFactionChallengePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionChallenge, mapOf(
            "subtype" to "2" // 试炼操作
        ))
        return repository.getAndParse<QueryFactionChallengePCResponse>(url)
    }

    // 帮派踢馆挑战
    suspend fun factionChallengeFight(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionChallenge, mapOf(
            "subtype" to "3" // 挑战操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 帮派踢馆领奖
    suspend fun factionChallengeClaimReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionChallenge, mapOf(
            "subtype" to "9" // 领奖操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 帮派踢馆领排名奖励
    suspend fun factionChallengeClaimRankReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionChallenge, mapOf(
            "subtype" to "10" // 领排行奖励操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 乐斗相关API ====================

    // 挑战好友、boss
    suspend fun fightPenguin(uin: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.fight, mapOf(
            "puin" to uin
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // 挑战帮友
    suspend fun fightFactionMember(uin: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.fight, mapOf(
            "uin" to uin
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询所有好友
    suspend fun queryAllFriend(selfUin: String): Result<QueryAllFriendPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.allFriendList, mapOf(
            HttpApiConstants.UrlParams.SELF_UIN to selfUin
        ))
        return repository.getAndParse<QueryAllFriendPCResponse>(url)
    }

    // 查询帮派成员
    suspend fun queryFactionMember(): Result<QueryFactionMemberPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionMember, mapOf())
        return repository.getAndParse<QueryFactionMemberPCResponse>(url)
    }

    // 查询企鹅信息
    suspend fun queryPenguinInfo(uin: String): Result<QueryPenguinInfoPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.penguinInfo, mapOf(
            "puin" to uin
        ))
        return repository.getAndParse<QueryPenguinInfoPCResponse>(url)
    }

    // 查询隐藏资料
    suspend fun queryHideInfo(puin: String): Result<QueryHideInfoResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.hideInfo, mapOf(
            "puin" to puin
        ))
        return repository.getAndParse<QueryHideInfoResponse>(url)
    }

    // 领取徒弟经验
    suspend fun getApprenticeExperience(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.getexp, mapOf())
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询浩劫宝箱信息
    suspend fun queryHavocTreasure(): Result<QueryHavocTreasureResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "142"
        ))
        return repository.getAndParse<QueryHavocTreasureResponse>(url)
    }

    // 领取浩劫宝箱
    suspend fun claimHavocTreasure(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "143"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询粮草信息
    suspend fun queryForageWar(): Result<QueryForageWarResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.forageWar, mapOf())
        return repository.getAndParse<QueryForageWarResponse>(url)
    }

    // 领取粮草奖励
    suspend fun claimForageWar(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.forageWar, mapOf(
            "subtype" to "6"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询NPC信息
    suspend fun queryNpcInfo(npcId: String): Result<QueryNpcInfoPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.npcInfo, mapOf(
            HttpApiConstants.UrlParams.ID to npcId
        ))
        return repository.getAndParse<QueryNpcInfoPCResponse>(url)
    }

    // ==================== 十二宫相关API ====================

    // 查询十二宫信息
    suspend fun queryConstellation(): Result<QueryConstellationPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.constellation, mapOf(
            "op" to "query"
        ))
        return repository.getAndParse<QueryConstellationPCResponse>(url)
    }

    // 自动扫荡十二宫
    suspend fun fightConstellation(sceneId: Int): Result<FightConstellationPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.constellation, mapOf(
            "op" to HttpApiConstants.OP.AUTO_FIGHT,
            HttpApiConstants.UrlParams.SCENE_ID to sceneId.toString()
        ))
        return repository.getAndParse<FightConstellationPCResponse>(url)
    }

    // ==================== 画卷迷踪相关API ====================

    // 查询画卷迷踪信息
    suspend fun queryScrollDungeon(): Result<QueryScrollDungeonResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.scrollDungeon, mapOf(
            // 查询操作，不带参数
        ))
        return repository.getAndParse<QueryScrollDungeonResponse>(url)
    }

    // 画卷迷踪挑战
    suspend fun fightScrollDungeon(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.scrollDungeon, mapOf(
            "op" to HttpApiConstants.OP.FIGHT // 挑战操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 世界树相关API ====================

    // 领取世界树材料
    suspend fun getWorldTreeMaterial(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.worldTree, mapOf(
            "id" to "1", // 灵宝树
            "op" to HttpApiConstants.OP.GET_PRICE // 领材料
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取世界树经验
    suspend fun getWorldTreeExperience(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.worldTree, mapOf(
            "id" to "1", // 灵宝数
            "op" to HttpApiConstants.OP.GET_EXPRIENCE, // 领经验
            HttpApiConstants.UrlParams.TASK_ID to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询灵宝树信息
    suspend fun queryBlessTree(): Result<QueryBlessTreeResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.worldTree, mapOf(
            "id" to "1", // 灵宝树
            "op" to HttpApiConstants.OP.BLESS_TREE // 查询灵宝树
        ))
        return repository.getAndParse<QueryBlessTreeResponse>(url)
    }

    // 查询源宝树信息
    suspend fun querySourceTree(): Result<QuerySourceTreePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.worldTree, mapOf(
            "op" to HttpApiConstants.OP.VIEW_EXPAND_INDEX // 查询源宝树
        ))
        return repository.getAndParse<QuerySourceTreePCResponse>(url)
    }

    // 喂养源宝树
    suspend fun feedSourceTree(weaponId: Int, times: Int = 1): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.worldTree, mapOf(
            "op" to HttpApiConstants.OP.DO_STRENGH, // 喂养
            HttpApiConstants.UrlParams.WEAPON_ID to weaponId.toString(),
            HttpApiConstants.UrlParams.TIMES to times.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 活跃度相关API ====================

    // 查询活跃度信息
    suspend fun queryLiveness(): Result<QueryLivenessResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.liveness, emptyMap())
        return repository.getAndParse<QueryLivenessResponse>(url)
    }

    // 领取活跃度礼包
    suspend fun getLivenessGift(giftBagId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.liveness, mapOf(
            "action" to "1",
            "giftbagid" to giftBagId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取帮派活跃度礼包
    suspend fun getFactionLivenessGift(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionLiveness, mapOf(
            "subtype" to "4"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 活跃礼包相关API ====================

    // 查询活跃礼包信息
    suspend fun queryActiveGift(): Result<QueryActiveGiftResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "85"
        ))
        return repository.getAndParse<QueryActiveGiftResponse>(url)
    }

    // 领取活跃礼包（50活跃度）
    suspend fun getActiveGiftLow(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "85",
            "op" to "1" // 领50活跃度
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取活跃礼包（80活跃度）
    suspend fun getActiveGiftHigh(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "85",
            "op" to "2" // 领80活跃度
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 深渊之潮相关API ====================

    // 查询深渊许愿点信息
    suspend fun queryAbyssTideGift(): Result<QueryAbyssTideGiftPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.VIEW_FACTION_GIFT// 查询许愿点信息操作
        ))
        return repository.getAndParse<QueryAbyssTideGiftPCResponse>(url)
    }

    // 查询深渊之潮进度信息
    suspend fun queryAbyssTide(): Result<QueryAbyssTidePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.VIEW_ALL_ABYSS // 查询操作
        ))
        return repository.getAndParse<QueryAbyssTidePCResponse>(url)
    }

    // 领取许愿点
    suspend fun getAbyssWishPoints(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.GET_FACTION_GIFT // 领许愿点操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 兑换挑战次数
    suspend fun addAbyssAccess(): Result<QueryAbyssTidePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.ADD_ACCESS // 兑换次数操作
        ))
        return repository.getAndParse<QueryAbyssTidePCResponse>(url)
    }

    // 进入深渊挑战
    suspend fun enterAbyss(abyssId: Int): Result<FightAbyssTidePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.ENTER_ABYSS, // 进入挑战操作
            HttpApiConstants.UrlParams.ID to abyssId.toString()
        ))
        return repository.getAndParse<FightAbyssTidePCResponse>(url)
    }

    // 开始深渊挑战
    suspend fun beginAbyssFight(): Result<FightAbyssTidePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.BEGIN_FIGHT // 挑战操作
        ))
        return repository.getAndParse<FightAbyssTidePCResponse>(url)
    }

    // 复活深渊挑战
    suspend fun reviveAbyss(): Result<FightAbyssTidePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.REVIVE // 复活操作
        ))
        return repository.getAndParse<FightAbyssTidePCResponse>(url)
    }

    // 结束深渊挑战
    suspend fun endAbyss(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.abyssTide, mapOf(
            "op" to HttpApiConstants.OP.END_ABYSS // 结束挑战操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 侠客岛相关 API ====================

    // 查询侠客岛任务
    suspend fun queryKnightIslandMission(): Result<QueryKnightIslandMissionPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightIsland, mapOf(
            "op" to HttpApiConstants.OP.VIEW_MISSION_INDEX
        ))
        return repository.getAndParse<QueryKnightIslandMissionPCResponse>(url)
    }

    // 快速委派侠客岛任务
    suspend fun autoAssignKnightMission(pos: Int): Result<QueryKnightIslandMissionPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightIsland, mapOf(
            "op" to HttpApiConstants.OP.AUTO_ASSIGN,
            "pos" to pos.toString()
        ))
        return repository.getAndParse<QueryKnightIslandMissionPCResponse>(url)
    }

    // 开始侠客岛任务
    suspend fun beginKnightMission(pos: Int): Result<QueryKnightIslandMissionPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightIsland, mapOf(
            "op" to "begin",
            "pos" to pos.toString()
        ))
        return repository.getAndParse<QueryKnightIslandMissionPCResponse>(url)
    }

    // 刷新侠客岛任务
    suspend fun refreshKnightMission(pos: Int): Result<QueryKnightIslandMissionPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightIsland, mapOf(
            "op" to HttpApiConstants.OP.REFRESH_MISSION,
            "pos" to pos.toString()
        ))
        return repository.getAndParse<QueryKnightIslandMissionPCResponse>(url)
    }

    // ==================== 江湖长梦相关 API ====================

    // 查询江湖长梦副本列表
    suspend fun queryKnightDream(): Result<QueryKnightDreamResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightDream, mapOf(
            "op" to "showCopyInfo" // 查看副本信息
        ))
        return repository.getAndParse<QueryKnightDreamResponse>(url)
    }

    // 开始江湖长梦副本
    suspend fun beginKnightDreamInstance(copyId: Int): Result<FightKnightDreamResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightDream, mapOf(
            "op" to HttpApiConstants.OP.BEGIN_INSTANCE, // 开始副本操作
            "copyid" to copyId.toString()
        ))
        return repository.getAndParse<FightKnightDreamResponse>(url)
    }

    // 结束江湖长梦副本
    suspend fun endKnightDreamInstance(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightDream, mapOf(
            "op" to HttpApiConstants.OP.END_INSTANCE // 结束副本操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 选择江湖长梦事件
    suspend fun chooseKnightDreamEvent(eventId: String): Result<FightKnightDreamResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightDream, mapOf(
            "op" to HttpApiConstants.OP.CHOOSE_EVENT, // 选择事件操作
            "event_id" to eventId
        ))
        return repository.getAndParse<FightKnightDreamResponse>(url)
    }

    // 选择江湖长梦奇遇
    suspend fun chooseKnightDreamAdventure(adventureId: Int): Result<FightKnightDreamResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightDream, mapOf(
            "op" to HttpApiConstants.OP.CHOOSE_ADVENTURE, // 选择奇遇操作
            "adventure_id" to adventureId.toString()
        ))
        return repository.getAndParse<FightKnightDreamResponse>(url)
    }

    // 江湖长梦进入下一天
    suspend fun goKnightDreamGoNextDay(): Result<FightKnightDreamResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightDream, mapOf(
            "op" to HttpApiConstants.OP.GO_NEXT_DAY // 进入下一天操作
        ))
        return repository.getAndParse<FightKnightDreamResponse>(url)
    }

    // ==================== 佣兵派遣相关 API ====================

    // 查询佣兵派遣状态
    suspend fun queryMercenaryDispatch(): Result<QueryMercenaryDispatchPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.mercenaryDispatch, mapOf(
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryMercenaryDispatchPCResponse>(url)
    }

    // 刷新佣兵派遣任务
    suspend fun refreshMercenaryDispatch(): Result<QueryMercenaryDispatchPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.mercenaryDispatch, mapOf(
            "op" to "1" // 刷新任务操作
        ))
        return repository.getAndParse<QueryMercenaryDispatchPCResponse>(url)
    }

    // 快速设置佣兵
    suspend fun quickSetupMercenary(missionId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.mercenaryDispatch, mapOf(
            "op" to "6", // 快速设置佣兵操作
            "mission_id" to missionId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 开始佣兵派遣任务
    suspend fun beginMercenaryMission(missionId: Int): Result<QueryMercenaryDispatchPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.mercenaryDispatch, mapOf(
            "op" to "7", // 开始任务操作
            "mission_id" to missionId.toString()
        ))
        return repository.getAndParse<QueryMercenaryDispatchPCResponse>(url)
    }

    // 领取佣兵派遣奖励
    suspend fun claimMercenaryReward(missionId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.mercenaryDispatch, mapOf(
            "op" to "8", // 领取奖励操作
            "mission_id" to missionId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 帮派祭坛相关API ====================

    // 查询帮派祭坛信息
    suspend fun queryFactionAltar(): Result<QueryFactionAltarResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.altar, mapOf())
        return repository.getAndParse<QueryFactionAltarResponse>(url)
    }


    // 开始帮派祭坛转盘
    suspend fun spinFactionAltarWheel(): Result<SpinFactionAltarWheelResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.altar, mapOf(
            "op" to HttpApiConstants.OP.SPIN_WHEEL,
        ))
        return repository.getAndParse<SpinFactionAltarWheelResponse>(url)
    }


    // 查询帮派祭坛掠夺信息
    suspend fun queryFactionAltarRob(): Result<QueryFactionAltarRobResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.altar, mapOf(
            "op" to HttpApiConstants.OP.SHOW_SPECIAL_TARGETS,
        ))
        return repository.getAndParse<QueryFactionAltarRobResponse>(url)
    }


    // 开始帮派祭坛掠夺
    suspend fun robFactionAltar(targetId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.altar, mapOf(
            "op" to "rob",
            "id" to targetId.toString(),
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }


    // 开始帮派祭坛偷取
    suspend fun stealFactionAltar(targetId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.altar, mapOf(
            "op" to "steal",
            "id" to targetId.toString(),
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 押镖相关API ====================

    // 查询押镖状态
    suspend fun queryEscortStatus(): Result<QueryEscortStatusPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.escort, mapOf(
            "op" to "15" // 查询当前押镖状态
        ))
        return repository.getAndParse<QueryEscortStatusPCResponse>(url)
    }

    // 领取押镖奖励
    suspend fun claimEscortReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.escort, mapOf(
            "op" to "16" // 领奖
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询押镖首页数据
    suspend fun queryEscortHome(): Result<QueryEscortHomeResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.escort, mapOf(
            "op" to "0" // 查询首页数据
        ))
        return repository.getAndParse<QueryEscortHomeResponse>(url)
    }

    // 选择押镖
    suspend fun chooseEscort(): Result<QueryEscortChooseResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.escort, mapOf(
            "op" to "7" // 选择押镖
        ))
        return repository.getAndParse<QueryEscortChooseResponse>(url)
    }

    // 开始押镖
    suspend fun startEscort(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.escort, mapOf(
            "op" to "6" // 开始押镖
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 刷新押镖选择
    suspend fun refreshEscort(): Result<QueryEscortChooseResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.escort, mapOf(
            "op" to "8" // 刷新
        ))
        return repository.getAndParse<QueryEscortChooseResponse>(url)
    }

    // 选择老板娘
    suspend fun chooseBossLady(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.escort, mapOf(
            "op" to "9" // 选老板娘
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 竞技场相关API ====================

    // 查询竞技场个人信息
    suspend fun queryArenaInfo(): Result<QueryArenaInfoPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.arena, mapOf())
        return repository.getAndParse<QueryArenaInfoPCResponse>(url)
    }

    // 领取竞技场每日奖励
    suspend fun claimArenaDailyReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.arena, mapOf(
            "op" to "dailyreward"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取竞技场段位奖励
    suspend fun claimArenaRankReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.arena, mapOf(
            "op" to "rankingreward"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 斗神塔相关API ====================

    // 查询斗神塔信息
    suspend fun queryFightTower(): Result<QueryFightTowerResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.towerFight, mapOf(
            "type" to "3" // 查询信息
        ))
        return repository.getAndParse<QueryFightTowerResponse>(url)
    }

    // 挑战斗神塔
    suspend fun fightTower(): Result<FightTowerResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.towerFight, mapOf(
            "type" to "0" // 挑战下一层
        ))
        return repository.getAndParse<FightTowerResponse>(url)
    }

    // 自动挑战斗神塔
    suspend fun autoFightTower(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.towerFight, mapOf(
            "type" to "3" // 自动挑战
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 复活斗神塔
    suspend fun reviveTower(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.towerFight, mapOf(
            "type" to "1" // 复活
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 结束斗神塔挑战
    suspend fun endTowerChallenge(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.towerFight, mapOf(
            "type" to "7" // 结束挑战
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 帮派任务相关API ====================
    // 查询帮派任务
    suspend fun queryFactionTask(): Result<QueryFactionTaskPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionTask, mapOf(
            "sub" to "1" // 查询任务
        ))
        return repository.getAndParse<QueryFactionTaskPCResponse>(url)
    }

    // 领取帮派任务奖励
    suspend fun claimFactionTaskReward(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionTask, mapOf(
            "sub" to "2", // 领取任务奖励
            "taskid" to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询帮派要闻
    suspend fun queryFactionStaff(page: Int = 1): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionStaff, mapOf(
            "page" to page.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询帮战信息
    suspend fun queryFactionWar(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionWar, mapOf(
            "id" to "7" // 查看帮战
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查看帮贡请求
    suspend fun queryFactionContributionRequest(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionTask, mapOf(
            "sub" to "3" // 查看帮贡
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 矿洞相关API ====================

    // 查询矿洞信息
    suspend fun queryFactionMine(): Result<QueryFactionMinePCResponse> {
        val url = HttpApiConstants.PcUrls.factionmine
        return repository.getAndParse<QueryFactionMinePCResponse>(url)
    }

    // 领取矿洞奖励
    suspend fun claimFactionMineReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionmine, mapOf(
            "op" to "reward"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 守护神供奉
    suspend fun feedDemo(itemId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.feedDemo, mapOf(
            "id" to itemId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询背包物品
    suspend fun queryBagGoods(uin: String): Result<BagGoodsPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.bagGoods, mapOf(
            HttpApiConstants.UrlParams.SELF_UIN to uin
        ))
        return repository.getAndParse<BagGoodsPCResponse>(url)
    }

    // 查询企鹅分享信息
    suspend fun queryPenguinShare(): Result<QueryPenguinShareResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.shareGame, mapOf(
            "subtype" to "3" // 查询分享信息
        ))
        return repository.getAndParse<QueryPenguinShareResponse>(url)
    }

    // 分享游戏
    suspend fun shareGame(shareType: Int): Result<ShareGameResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.shareGame, mapOf(
            "subtype" to "1",
            "shareinfo" to shareType.toString()
        ))
        return repository.getAndParse<ShareGameResponse>(url)
    }

    // ==================== 企鹅任务相关API ====================

    // 查询日常任务
    suspend fun queryPenguinTask(uin: String): Result<QueryPenguinTaskPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.task, mapOf(
            HttpApiConstants.UrlParams.SELF_UIN to uin,
            "sub" to "1" // 查询任务
        ))
        return repository.getAndParse<QueryPenguinTaskPCResponse>(url)
    }

    // 领取日常任务奖励
    suspend fun rewardPenguinTask(uin: String, taskId: Int): Result<RewardPenguinTaskPCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.task, mapOf(
            HttpApiConstants.UrlParams.SELF_UIN to uin,
            "sub" to "4", // 领取任务奖励
            "id" to taskId.toString()
        ))
        return repository.getAndParse<RewardPenguinTaskPCResponse>(url)
    }

    // ==================== 武林盟主相关API ====================

    // 查询武林盟主信息
    suspend fun queryWlmz(): Result<QueryWlmzResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wlmz, mapOf(
            "op" to "view_index" // 查询操作
        ))
        return repository.getAndParse<QueryWlmzResponse>(url)
    }

    // 武林盟主报名
    suspend fun signupWlmz(groundId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wlmz, mapOf(
            "op" to "signup", // 报名操作
            "ground_id" to groundId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 武林盟主领奖
    suspend fun getWlmzAward(roundId: Int, sectionId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wlmz, mapOf(
            "op" to "get_award", // 领奖操作
            "round_id" to roundId.toString(),
            "section_id" to sectionId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 武林盟主猜排名
    suspend fun guessWlmzRanking(index: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wlmz, mapOf(
            "op" to "guess_up", // 猜排名操作
            "index" to index.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 武林盟主确认猜排名
    suspend fun confirmWlmzGuess(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wlmz, mapOf(
            "op" to "comfirm" // 确认猜排名操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 佣兵助阵相关API ====================

    // 查询佣兵助阵类型列表
    suspend fun queryFormationTypes(): Result<QueryFormationTypeResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.formation, mapOf(
            "type" to "6" // 查询助阵类型
        ))
        return repository.getAndParse<QueryFormationTypeResponse>(url)
    }

    // 查询佣兵助阵组合列表
    suspend fun queryFormationList(formationType: Int, index: Int = 0): Result<QueryFormationListResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.formation, mapOf(
            "type" to "1", // 查询组合列表
            HttpApiConstants.UrlParams.FORMATION_TYPE to formationType.toString(),
            "index" to index.toString()
        ))
        return repository.getAndParse<QueryFormationListResponse>(url)
    }

    // 激活佣兵助阵
    suspend fun activateFormation(formationType: Int, formationId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.formation, mapOf(
            "type" to "2", // 激活助阵
            HttpApiConstants.UrlParams.FORMATION_TYPE to formationType.toString(),
            "formationid" to formationId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 提升佣兵助阵属性
    suspend fun upgradeFormationAttr(formationType: Int, formationId: Int, attrIndex: Int, times: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.formation, mapOf(
            "type" to "3", // 提升助阵
            HttpApiConstants.UrlParams.FORMATION_TYPE to formationType.toString(),
            "formationid" to formationId.toString(),
            "attrindex" to attrIndex.toString(),
            "times" to times.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 深渊秘宝相关API ====================

    // 查询深渊秘宝信息
    suspend fun queryAbyssDraw(): Result<QueryAbyssDrawResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "164",
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryAbyssDrawResponse>(url)
    }

    // 深渊秘宝抽奖
    suspend fun drawAbyss(type: Int): Result<QueryAbyssDrawResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "164",
            "op" to "1", // 抽奖操作
            "type" to type.toString(),
            "times" to "1"
        ))
        return repository.getAndParse<QueryAbyssDrawResponse>(url)
    }

    // ==================== 幸运金蛋相关API ====================

    // 查询幸运金蛋信息
    suspend fun queryLuckyGoldenEgg(): Result<QueryLuckyGoldenEggResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "102",
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryLuckyGoldenEggResponse>(url)
    }

    // 领取幸运金蛋
    suspend fun claimLuckyGoldenEgg(index: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "102",
            "op" to "1", // 领取操作
            "index" to index.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 菜菜厨房相关API ====================

    // 查询菜菜厨房信息
    suspend fun queryKitchen(): Result<QueryKitchenResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "34"
        ))
        return repository.getAndParse<QueryKitchenResponse>(url)
    }

    // 领取菜菜厨房体力
    suspend fun claimKitchen(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "34",
            "op" to "eat" // 领取体力操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 帮派黄金联赛相关API ====================
    // 查询帮派黄金联赛信息
    suspend fun queryFactionLeague(): Result<QueryFactionLeagueResponse> {
        val url = HttpApiConstants.PcUrls.factionLeague
        return repository.getAndParse<QueryFactionLeagueResponse>(url)
    }

    // 帮派黄金联赛参与防守
    suspend fun factionLeagueDefend(): Result<QueryFactionLeagueResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionLeague, mapOf(
            "op" to "1" // 参与防守操作
        ))
        return repository.getAndParse<QueryFactionLeagueResponse>(url)
    }

    // 帮派黄金联赛领奖（根据op）
    suspend fun factionLeagueClaimReward(op: String): Result<QueryFactionLeagueResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionLeague, mapOf(
            "op" to op // 领奖操作
        ))
        return repository.getAndParse<QueryFactionLeagueResponse>(url)
    }

    // ==================== 豆油召回相关API ====================

    // 查询豆油召回信息
    suspend fun queryPenguinRecall(): Result<QueryPenguinRecallResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.recall, mapOf(
            "subtype" to "3" // 查询操作
        ))
        return repository.getAndParse<QueryPenguinRecallResponse>(url)
    }

    // 召回豆油
    suspend fun recallPenguin(opuin: Long): Result<QueryPenguinRecallResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.recall, mapOf(
            "subtype" to "4", // 召回操作
            "opuin" to opuin.toString()
        ))
        return repository.getAndParse<QueryPenguinRecallResponse>(url)
    }

    // ==================== 乐斗驿站相关API ====================

    // 查询乐斗驿站信息
    suspend fun queryPenguinStation(): Result<QueryPenguinStationResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "156",
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryPenguinStationResponse>(url)
    }

    // 领取乐斗驿站奖励
    suspend fun claimPenguinStation(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "156",
            "op" to "2" // 领奖操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询附魔信息
    suspend fun queryEnchant(): Result<QueryEnchantResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.enchant, mapOf(
            "op" to "viewindex" // 查询操作
        ))
        return repository.getAndParse<QueryEnchantResponse>(url)
    }

    // 领取附魔奖励
    suspend fun claimEnchant(missionId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.enchant, mapOf(
            "op" to "gettaskreward", // 领取操作
            "missionId" to missionId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 奥义相关API ====================

    // 查询奥义信息
    suspend fun querySkillEnhance(): Result<QuerySkillEnhanceResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.skillEnhance, mapOf(
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QuerySkillEnhanceResponse>(url)
    }

    // ==================== 武器专精相关API ====================

    // 查询武器专精信息
    suspend fun queryWeaponSpecialize(typeId: Int): Result<QueryWeaponSpecializeResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.weaponSpecialize, mapOf(
            "op" to "0", // 查询操作
            HttpApiConstants.UrlParams.TYPE_ID to typeId.toString() // type_id: 0、1、2、3
        ))
        return repository.getAndParse<QueryWeaponSpecializeResponse>(url)
    }

    // ==================== 神魔相关API ====================

    // 查询神魔阵法信息
    suspend fun queryAncientGodFormation(): Result<QueryAncientGodFormationResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.ancientGod, mapOf(
            "op" to "2" // 查询神魔阵法操作
        ))
        return repository.getAndParse<QueryAncientGodFormationResponse>(url)
    }

    // ==================== 神装相关API ====================

    // 查询神装信息
    suspend fun queryOutfit(): Result<QueryOutfitResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.outfit, mapOf(
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryOutfitResponse>(url)
    }

    // ==================== 六门会武相关API ====================

    // 查询六门会武助威信息
    suspend fun querySectMeleeCheer(): Result<QuerySectMeleeCheerResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectMelee, mapOf(
            "op" to "showcheer" // 查询操作
        ))
        return repository.getAndParse<QuerySectMeleeCheerResponse>(url)
    }

    // 六门会武助威
    suspend fun cheerSectMelee(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectMelee, mapOf(
            "op" to "cheer", // 助威操作
            "sect" to "1003"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 查询六门会武奖励
    suspend fun querySectMeleeReward(): Result<QuerySectMeleeRewardResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectMelee, mapOf(
            "op" to "showreward" // 查询奖励操作
        ))
        return repository.getAndParse<QuerySectMeleeRewardResponse>(url)
    }

    // 领取六门会武奖励
    suspend fun claimSectMeleeReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectMelee, mapOf(
            "op" to "drawreward" // 领取奖励操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 问鼎天下相关API ====================
    
    // 查询问鼎天下信息
    suspend fun queryTBattle(): Result<QueryTBattleResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.tBattle, mapOf(
            "op" to "index"
        ))
        return repository.getAndParse<QueryTBattleResponse>(url)
    }
    
    // 助威区域赛
    suspend fun cheerRegionBattle(factionId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.tBattle, mapOf(
            "op" to "cheerregionbattle",
            "faction" to factionId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }
    
    // 助威冠军赛
    suspend fun cheerChampionBattle(factionId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.tBattle, mapOf(
            "op" to "cheerchampionbattle",
            "faction" to factionId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 乱斗相关API ====================
    // 查询乱斗任务信息
    suspend fun queryChaosWar(): Result<QueryChaosWarResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.chaosWar, mapOf(
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryChaosWarResponse>(url)
    }

    // 领取乱斗任务奖励
    suspend fun claimChaosWar(taskId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.chaosWar, mapOf(
            "op" to "8", // 领取操作
            "id" to taskId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 刷新乱斗任务
    suspend fun refreshChaosWar(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.chaosWar, mapOf(
            "op" to "7" // 刷新操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }
    
    // 查询乱斗竞技任务 (op=9, acttype从2到4)
    suspend fun queryChaosWarTasks(acttype: Int): Result<QueryChaosWarTaskResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.chaosWar, mapOf(
            "op" to "9", // 竞技任务操作
            "acttype" to acttype.toString()
        ))
        return repository.getAndParse<QueryChaosWarTaskResponse>(url)
    }

    // ==================== 生日相关API ====================

    // 查询生日信息
    suspend fun queryBirthday(): Result<QueryBirthdayResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.birthday, emptyMap())
        return repository.getAndParse<QueryBirthdayResponse>(url)
    }

    // 送生日祝福
    suspend fun sendBirthdayWishes(receiver: Long): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.birthday, mapOf(
            "op" to "sendwishes",
            "receiver" to receiver.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 刷新祝福好友列表
    suspend fun refreshBirthdayFriends(): Result<QueryBirthdayResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.birthday, mapOf(
            "op" to "getrandomfriends"
        ))
        return repository.getAndParse<QueryBirthdayResponse>(url)
    }

    // 领取祝福大礼
    suspend fun getBirthdayWishesPresent(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.birthday, mapOf(
            "op" to "getwishespresent"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取专属大礼
    suspend fun getBirthdayFreePresent(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.birthday, mapOf(
            "op" to "getfreepresent"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取友好度礼包
    suspend fun getBirthdayWishDegreePresent(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.birthday, mapOf(
            "op" to "getwishdegreepresent"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 许愿相关API ====================

    // 查询许愿信息
    suspend fun queryWish(): Result<QueryWishResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wish, mapOf(
            "sub" to "1" // 查询操作
        ))
        return repository.getAndParse<QueryWishResponse>(url)
    }

    // 领取许愿奖
    suspend fun getWishReward(): Result<RewardWishResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wish, mapOf(
            "sub" to "3" // 领许愿奖操作
        ))
        return repository.getAndParse<RewardWishResponse>(url)
    }

    // 领取许愿宝箱
    suspend fun getWishChest(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wish, mapOf(
            "sub" to "6" // 领宝箱操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 许愿
    suspend fun wish(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wish, mapOf(
            "sub" to "2" // 许愿
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 帮派远征相关API ====================

    // 查询帮派远征信息
    suspend fun queryFactionArmy(islandId: Int): Result<QueryFactionArmyResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionArmy, mapOf(
            "op" to "viewIndex", // 查询操作
            "island_id" to islandId.toString()
        ))
        return repository.getAndParse<QueryFactionArmyResponse>(url)
    }

    // 领取帮派军队节点奖励
    suspend fun getFactionArmyPointAward(pointId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionArmy, mapOf(
            "op" to "getPointAward", // 领取节点奖励操作
            "point_id" to pointId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 领取帮派军队岛屿奖励
    suspend fun getFactionArmyIslandAward(islandId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.factionArmy, mapOf(
            "op" to "getIslandAward", // 领取岛屿奖励操作
            "island_id" to islandId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 巅峰之战相关API ====================

    // 查询巅峰之战状态
    suspend fun queryPeakBattle(): Result<QueryPeakBattleResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.peakBattle, mapOf(
            "sub" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryPeakBattleResponse>(url)
    }

    // 巅峰之战报名
    suspend fun signupPeakBattle(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.peakBattle, mapOf(
            "sub" to "1" // 报名操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 巅峰之战领奖
    suspend fun claimPeakBattle(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.peakBattle, mapOf(
            "sub" to "4" // 领奖操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 幸运转盘相关API ====================
    
    // 查询幸运转盘信息
    suspend fun queryLuckyWheel(): Result<QueryLuckyWheelResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "50" // 幸运转盘
        ))
        return repository.getAndParse<QueryLuckyWheelResponse>(url)
    }
    
    // 转动幸运转盘
    suspend fun rollLuckyWheel(): Result<QueryLuckyWheelResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "50", // 幸运转盘
            "op" to "roll" // 转动操作
        ))
        return repository.getAndParse<QueryLuckyWheelResponse>(url)
    }

    // ==================== 武林大会相关API ====================

    // 查询武林大会状态
    suspend fun queryWulin(): Result<QueryWulinResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.wulin, mapOf(
            "level" to "1"
        ))
        return repository.getAndParse<QueryWulinResponse>(url)
    }

    // 武林大会电脑报名
    suspend fun signupWulin(wulinId: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.fastSignWulin, mapOf(
            "ifFirstSign" to "1",
            "id" to wulinId
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 门派邀请赛相关API ====================

    // 查询门派邀请赛状态
    suspend fun querySectTournament(): Result<QuerySectTournamentResponse> {
        val url = HttpApiConstants.PcUrls.sectTournament
        return repository.getAndParse<QuerySectTournamentResponse>(url)
    }

    // 门派邀请赛报名
    suspend fun signupSectTournament(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectTournament, mapOf(
            "op" to "signup"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 门派邀请赛邀请队友
    suspend fun inviteSectTournamentFriend(uin: String): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.sectTournament, mapOf(
            "op" to "invite",
            "type" to "1",
            "invitee" to uin
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 群雄逐鹿相关API ====================

    // 查询群雄逐鹿状态
    suspend fun queryThronesBattle(): Result<QueryThronesBattleResponse> {
        val url = HttpApiConstants.PcUrls.thronesBattle
        return repository.getAndParse<QueryThronesBattleResponse>(url)
    }

    // 群雄逐鹿报名
    suspend fun signupThronesBattle(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.thronesBattle, mapOf(
            "op" to "signup"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 群雄逐鹿领奖
    suspend fun claimThronesBattleReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.thronesBattle, mapOf(
            "op" to "drawreward"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 群雄逐鹿领排名奖
    suspend fun claimThronesBattleRankReward(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.thronesBattle, mapOf(
            "op" to "drawrankreward"
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 九宫宝库相关API ====================

    // 查询九宫宝库信息
    suspend fun queryLottery(): Result<QueryLotteryResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.lottery, mapOf())
        return repository.getAndParse<QueryLotteryResponse>(url)
    }

    // ==================== 乐斗菜单相关API ====================

    // 查询乐斗菜单信息
    suspend fun queryActMenu(): Result<QueryActMenuResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.menuact, mapOf())
        return repository.getAndParse<QueryActMenuResponse>(url)
    }

    // 领取乐斗菜单礼物
    suspend fun claimActMenuGift(giftId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.menuact, mapOf(
            "sub" to "1", // 领取操作
            "gift" to giftId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 侠士论剑相关API ====================

    // 查询侠士论剑状态
    suspend fun queryKnightArena(): Result<QueryKnightArenaResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightArena, mapOf(
            "op" to "query" // 查询操作
        ))
        return repository.getAndParse<QueryKnightArenaResponse>(url)
    }

    // 查询侠士论剑侠士列表
    suspend fun queryKnightArenaList(): Result<QueryKnightArenaListResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightArena, mapOf(
            "op" to "showknightlist" // 查看侠士列表操作
        ))
        return repository.getAndParse<QueryKnightArenaListResponse>(url)
    }

    // 查询侠士论剑当前阵容
    suspend fun queryKnightArenaTeam(): Result<QueryKnightAreanTeamResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightArena, mapOf(
            "op" to "dormteam" // 查看当前阵容操作
        ))
        return repository.getAndParse<QueryKnightAreanTeamResponse>(url)
    }

    // 设置侠士上阵
    suspend fun replaceKnightArenaKnight(pos: Int, knightId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightArena, mapOf(
            "op" to "replaceknight", // 上阵操作
            "pos" to pos.toString(), // 位置0-2
            "knightid" to knightId.toString()
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // 挑战侠士论剑
    suspend fun challengeKnightArena(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightArena, mapOf(
            "op" to "challenge" // 挑战操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    suspend fun queryKnightArenaFight(id: String): Result<QueryKnightFightResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightArena, mapOf(
            "op" to "replay", // 查询操作
            "repid" to id
        ))
        return repository.getAndParse<QueryKnightFightResponse>(url)
    }

    // ==================== 群侠相关API ====================

    // 查询群侠对战信息
    suspend fun queryKnightFight(id: String): Result<QueryKnightFightResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.knightFight, mapOf(
            "op" to "view_my_replay", // 查对战信息操作
            "id" to id
        ))
        return repository.getAndParse<QueryKnightFightResponse>(url)
    }

    // ==================== 猜单双相关API ====================

    // 查询猜单双信息
    suspend fun queryOddEven(): Result<QueryOddEvenResponse> {
        val url = HttpApiConstants.PcUrls.oddEven
        return repository.getAndParse<QueryOddEvenResponse>(url)
    }

    // 猜单双
    suspend fun guessOddEven(value: Int): Result<QueryOddEvenResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.oddEven, mapOf(
            "value" to value.toString() // 1为单，2为双
        ))
        return repository.getAndParse<QueryOddEvenResponse>(url)
    }

    // ==================== 登录有礼相关API ====================

    // 查询登录有礼信息
    suspend fun queryLoginGift(): Result<QueryLoginGiftResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "49"
        ))
        return repository.getAndParse<QueryLoginGiftResponse>(url)
    }

    // 领取登录有礼奖励
    suspend fun claimLoginGift(giftType: Int, giftIndex: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.newAct, mapOf(
            "subtype" to "49",
            "op" to "draw", // 领取操作
            "gift_type" to giftType.toString(), // 1为免费，2为付费
            "gift_index" to giftIndex.toString() // 数组的index，从0开始
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 周周礼包相关API ====================

    // 查询周周礼包信息
    suspend fun queryWeeklyGift(): Result<QueryWeeklyGiftResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.weekGiftBag, mapOf(
            "sub" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryWeeklyGiftResponse>(url)
    }

    // 领取周周礼包奖励
    suspend fun claimWeeklyGift(dayId: Int): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.weekGiftBag, mapOf(
            "sub" to "1", // 领取操作
            "id" to dayId.toString() // 周几，1-7
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    // ==================== 徽章战令相关API ====================

    // 查询徽章战令信息
    suspend fun queryBadge(): Result<QueryBadgeResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.badge, mapOf(
            "op" to "0" // 查询操作
        ))
        return repository.getAndParse<QueryBadgeResponse>(url)
    }

    // 领取徽章战令奖励
    suspend fun claimBadge(): Result<SimplePCResponse> {
        val url = UrlUtils.buildUrl(HttpApiConstants.PcUrls.badge, mapOf(
            "op" to "1" // 领奖操作
        ))
        return repository.getAndParse<SimplePCResponse>(url)
    }

    /**
     * 查询原始数据（用于自定义任务）
     * @param url 请求URL
     * @param uin 用户ID
     * @return SimplePCResponse
     */
    suspend fun queryRawData(url: String, uin: String): Result<SimplePCResponse> {
        val processedUrl = if (url.contains("selfuin=")) {
            url
        } else {
            val separator = if (url.contains("?")) "&" else "?"
            "$url${separator}selfuin=$uin"
        }
        return repository.getAndParse<SimplePCResponse>(processedUrl)
    }

    companion object {
        @Volatile
        private var INSTANCE: GameApi? = null
        
        // 获取GameApi单例
        fun getInstance(): GameApi {
            return INSTANCE ?: synchronized(this) {
                INSTANCE ?: GameApi().also { INSTANCE = it }
            }
        }
    }
}
